#include <bits/stdc++.h>

using namespace std;
#define int long long

int myabs(int x) {
	if (x > 0) return x;
	return -x;
}

int n, a[200005], b[200005];

namespace CR200J {
	int ans[1003];
	void main() {
		memset(ans, 31, sizeof(ans));
		for (int i = 1; i <= n; ++i) {
			int ma = 1ll << 60, mb = 1ll << 60;
			for (int j = i; j <= n; ++j) {
				ma = min(ma, a[j]);
				mb = min(mb, b[j]);
			ans[j - i + 1] = min(ans[j - i + 1], abs(ma - mb));
			}
		}
		for (int i = 1; i <= n; ++i) {
			cout << ans[i] << "\n";
		}
	}
}

namespace CRH380A {
	void main() {
		int ma = 1ll << 60;
		for (int i = 1; i <= n; ++i) {
			ma = min(ma, a[i]);
		}
		for (int i = 1; i <= n; ++i) {
			cout << (ma - 1) << "\n";
		}
	}
}

namespace CRH380D {
	int suf[200005], lft[200005], rig[200005], st[200005], top;
	void main() {
		for (int i = 1; i <= n; ++i) {
			while (top && a[i] < a[st[top]]) {
				rig[st[top]] = i;
				--top;
			}
			st[++top] = i;
		}
		while (top) {
			rig[st[top]] = n + 1;
			--top;
		}
		for (int i = n; i >= 1; --i) {
			while (top && a[i] < a[st[top]]) {
				lft[st[top]] = i;
				--top;
			}
			st[++top] = i;
		}
		for (int i = 1; i <= n; ++i) {
			suf[rig[i] - lft[i] - 1] = max(suf[rig[i] - lft[i] - 1], a[i]);
		}
		for (int i = n; i >= 1; --i) suf[i] = max(suf[i], suf[i + 1]);
		for (int i = 1; i <= n; ++i) {
			cout << b[1] - suf[i] << "\n";
		}
	}
}
namespace BF5033 {
	/*
[	    A     ]
       [  B       ]
*/
	int ans[200005], st[200005], top, lft[200005], rig[200005];
	vector<array<int, 3>> qrs[200005];
	void main() {
		for (int i = 1; i <= n; ++i) {
			while (top && a[i] < a[st[top]]) {
				rig[st[top]] = i;
				--top;
			}
			st[++top] = i;
		}
		while (top) {
			rig[st[top]] = n + 1;
			--top;
		}
		for (int i = n; i >= 1; --i) {
			while (top && a[i] < a[st[top]]) {
				lft[st[top]] = i;
				--top;
			}
			st[++top] = i;
		}
		for (int i = 1; i <= n; ++i) {
			int rgt = i, lft = i;
			while (rgt <= n && b[rgt] >= b[i]) ++rgt;
			while (lft >= 1 && b[lft] >= b[i]) --lft;
			for (int j = lft + 1; j < rgt; ++j) {
				qrs[j].push_back({lft + 1, rgt - 1, i});
			}
		}
		memset(ans, 31, sizeof(ans));
		for (int i = 1; i <= n; ++i) {
			for (auto j : qrs[i]) {
				if (j[2] > lft[i] && j[2] < rig[i]) {
				//	cout << i << " " << j[2] << "\n";
					int mindst = abs(j[2] - i) + 1;
					int maxdst = min(j[1], rig[i] - 1) - max(j[0], lft[i] + 1) + 1;
					if (mindst == 1) {
					}
					for (int l = mindst; l <= maxdst; ++l) {
						ans[l] = min(ans[l], abs(a[i] - b[j[2]]));
					}
				}
			}
		}
		for (int i = 1; i <= n; ++i) {
			cout << ans[i] << "\n";
		}
	}
}
signed main() {
	freopen("min.in", "r", stdin); freopen("min.out", "w", stdout);
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	bool all1 = 1, alli = 1;
	for (int j = 1; j <= n; ++j) {
		cin >> b[j];
		all1 &= (b[j] == 1);
		alli &= (b[j] == 1e9);
	}
	if (n <= 1000) {
		CR200J::main();
	} else if (all1) {
		CRH380A::main();
	} else if (alli) CRH380D::main();
	else  BF5033::main();
	return 0;
}
